
import { GET_TO_DO_LIST } from './mutation-types';

const actions = {
    // ctx: { commit: (arg0: string, arg1: any) => void }
    // @ts-ignore
    getList( { commit } ): Promise<AjaxDataModel.DataKey[]> {
        let data: AjaxDataModel.DataKey[] = []
        return new Promise((resolve, reject) => {
            setTimeout(() => {
                for( let i = 0; i < 10; i++ ){
                    data.push({
                        id: i,
                        name: `商品${i}`,
                        price: (i+1)*2 
                    })
                }
                commit(GET_TO_DO_LIST, data)
                resolve(data)
            },3000 )
        })
        
    }
}

export default actions